namespace :data do
	task :create_super_user => :environment do
		puts "login: admin; pass: ghjtrn21"
		User.delete_all("login = 'admin'")
		user = User.new(
						:login=>"admin", 
						:name=>"Administrator", 
						:password=>"ghjtrn21", 
						:password_confirmation=>"ghjtrn21", 
						:email=>"igor.com.ua@gmail.com")
  	user.save!
		puts "Created."
	end

	task :setup => [:create_super_user]	
		
  task :currency => :environment do 
		puts "Start parse => #{Time.now.strftime('%H:%M')}"
		Currency.parse
		puts "End parse => #{Time.now.strftime('%H:%M')}"
  end
  
  task :recalc_tree => :environment do
  	Category.renumber_all
  end
end
